package com.wxw.gulidemo.utils;/**
 * @author by xxz
 * @date 2022/6/20
 */

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @Description

 * @author by xxz

 * @date 2022/6/20

 * @throws
 */
@Component
public class OrderNoUtils {


    /**
     * 获取订单号
     * @return
     */
    public static String getOrderNo() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate = sdf.format(new Date());
        String result = "";
        Random random = new Random();
        for (int i = 0; i < 3; i++) {
            result += random.nextInt(10);
        }
        return newDate + result;
    }


}
